// PointService.java
package com.jhzn.geomap.service;

import com.jhzn.geomap.mapper.PointMapper;
import com.jhzn.geomap.model.Point;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PointService {
    private final PointMapper pointMapper;

    public PointService(PointMapper pointMapper) {
        this.pointMapper = pointMapper;
    }

    public Point createPoint(Point point) {
        pointMapper.insert(point);
        return point;
    }

    public Point updatePoint(Point point) {
        pointMapper.update(point);
        return point;
    }

    public List<Point> getAllPoints() {
        return pointMapper.findAll();
    }

    public void deletePoint(Long id) {
        pointMapper.delete(id);
    }
}
